#ifndef XGFUNCTIONSLOT_H
#define XGFUNCTIONSLOT_H

class NullClass;

#include "XgSlot.h"

/************************************************************************/
/* Class XgFunctionSlot (params: 1) Basic Template                        */
/************************************************************************/
template<typename P1 = NullClass>
class XgFunctionSlot : public XgSlot<P1>
{
public:
	typedef void (*Function)(P1);
public:
	XgFunctionSlot(Function function)
		: _function(function)
	{
	}
public:
	virtual void invoke(P1 a)
	{
		(*_function)(a);
	}
private:
	Function _function;
};

/************************************************************************/
/* Class XgFunctionSlot (params: 0)                                       */
/************************************************************************/
template<>
class XgFunctionSlot<NullClass> : public XgSlot<>
{
public:
	typedef void (*Function)();
public:
	XgFunctionSlot(Function function)
		: _function(function)
	{
	}
public:
	virtual void invoke()
	{
		(*_function)();
	}
private:
	Function _function;
};

#endif //XGFUNCTIONSLOT_H